import http, { get, post } from "./http";
/* ***************** 登录页 ***************** */
// 登录时获取token
export const $login = (params) =>
  http({
    url: "http://123.56.90.95:88/blade-auth/oauth/token",
    method: "post",
    headers: {
      Authorization: "Basic c2FiZXI6c2FiZXJfc2VjcmV0",
    },
    params: {
      grant_type: "password",
      scope: "all",
      type: "account",
      ...params,
    },
  });

/* ***************** 通用 ***************** */
// 获取租户信息
export const $getTenantId = () => get("/api/webclientserver/getTenantList");
// 获取园区
export const $getPark = (params) =>
  get("/api/webclientserver/getParkAndFacilitiesTreeByTenantId", params);

/* ***************** 设施大屏 ***************** */
// 监控数据 - 传感器列表
export const $getSensor = (params) =>
  get("/api/webclientserver/getSensorByFacilities", params);
// 获取控制器列表
export const $getControl = (params) =>
  get("/api/webclientserver/getControlByFacilities", params);
export const $getCamera = (params) =>
  get("/api/webclientserver/getCameraByFacilities", params);
// 获取当前设施的计划
export const $getCurrentPlantingPlan = (params) =>
  get("/api/webclientserver/getCurrentPlantingPlan", params);
// 识别记录查询
export const $getIdentificationRecord = (params) =>
  get("/api/webclientserver/getIdentificationRecord", params);

/* ***************** 历史种植 ***************** */
// 获取种植计划列表
export const $getPlantingPlan = (params) =>
  get("/api/webclientserver/getPlantingPlan", params);

/* ***************** 消息统计 ***************** */
// 获取消息类型列表
export const $getMessageTypeList = (params) =>
  get("/api/statistics/getMessageTypeList", params);
// 查询消息
export const $getMessageList = (params) =>
  get("/api/statistics/getMessageList", params);

/* ***************** 自定义大屏 ***************** */
// 获取租户信息
export const $getTenantInfo = (params) =>
  get("/api/echarts/getTenantInfoById", params);
// 获取传感器数量
export const $getSensorCount = (paams) => get("/api/echarts/getSensorCount");
// 获取所有消息
export const $getMessageCount = (params) =>
  get("/api/echarts/getMessageCountByParkId", params);
// 获取园区种植数量
export const $getCropVarieties = (parmas) =>
  get("/api/echarts/getCropVarietiesByParkId", parmas);
// 获取园区进行中计划
export const $getCurrentPlantingPlanListByParkId = (parmas) =>
  get("/api/echarts/getCurrentPlantingPlanListByParkId", parmas);
// 获取园区摄像头
export const $getCameraListByParkId = (params) =>
  get("/api/echarts/getCameraListByParkId", params);
// 获取设施数量
export const $getCount = () => get("/api/echarts/getFacilitiesCountForEcharts");
// 获取天气
export const $getWeather = (
  province = "北京",
  city = "北京",
  county = "东城区"
) =>
  get(
    `/qqweather/common?source=pc&weather_type=observe|forecast_24h&province=${province}&city=${city}&county=${county}`
  );
// 获取轮播图照片
export const $getPhoto = (params) =>
  get("/api/echarts/getPhotoForEcharts", params);
// 获取告警统计
export const $getWarningInfo = () =>
  get("/api/echarts/getAllWarningCountByTenantIdForEcharts");
// 获取实时数据
export const $getSensorlastDayData = () =>
  get("/api/echarts/getSensorlastDayDataByFacilityIdForEcharts");
// 获取大屏视频
export const $getIdentificationStaticForEcharts = (params) =>
  get("/api/echarts/getIdentificationStaticForEcharts", params);
